package com.wave.spring;

import com.wave.spring.boot.plugs.CanonCustomApplicationInitializer;
import com.wave.spring.boot.plugs.CanonCustomApplicationListener;
import com.wave.spring.jpa.CustomFactoryBean;
import jmind.base.util.reflect.ClassUtil;
import jmind.core.log.LogUtil;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.boot.builder.SpringApplicationBuilder;
import org.springframework.cache.annotation.EnableCaching;
import org.springframework.context.ConfigurableApplicationContext;
import org.springframework.data.jpa.repository.config.EnableJpaRepositories;
import uk.org.lidalia.sysoutslf4j.context.SysOutOverSLF4J;

/**
 * Pandora Boot应用的入口类
 *
 * @author chengxu
 */
@SpringBootApplication(scanBasePackages = {"com.wave.spring"})
//@EnableJpaRepositories(repositoryFactoryBeanClass = CustomFactoryBean.class)
//@EnableCaching
public class Application {

    public static void main(String[] args) {

       // SpringApplication.run(Application.class, args);


        ConfigurableApplicationContext context = new SpringApplicationBuilder(Application.class).web(true).
                initializers(new CanonCustomApplicationInitializer()).
                listeners(new CanonCustomApplicationListener())
                .build().run(args);
        SysOutOverSLF4J.sendSystemOutAndErrToSLF4J();
        System.err.println("this is err");
        System.out.println("this is out");
        LogUtil.info("clazz--{},{}",System.err.getClass(),System.out.getClass());

    }
}
